<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<?php $this->load->view('layout/Header'); ?>
	    <?php $this->load->view('layout/Modal'); ?>
		<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>Resources/Styles/Item_Details.css" /> 
		<title>DotA 2 Shop</title>
	    
	</head>
	<body>

		<!-- Nav bar -->

		<?php $this->load->view('layout/Navbar'); ?>

		<!-- End Nav -->

		<div class="row" id="row1">
			<div class="col-md-1"></div>

			<div class="col-md-10" id="menubar">
				<?php $this->load->view('layout/Menubar', $hero); ?>
			</div>
		</div>
		
		<br/>

		<!-- Content -->
		<div class="row">
			<div class="col-md-1">
			</div>

			<div class="col-md-10">
				<?php foreach($item_details as $item_detail): ?>
				<!-- Item Details -->
				<div class="ItemDetails">
					<div class="row Header">
						<div class="col-md-12">
							<h2><?php print $item_detail->ITEM_NAME; ?></h2>
						</div>
					</div>
					<div class="InfoItem">
						<div class="row">
							<div class="col-md-7">
								<div class="ImageItem">
									<img class="productimage" src="<?php print $item_detail->ITEM_IMAGE; ?>">
								</div>
							</div>

							<div class="col-md-5">
								<div class="InfoDetails">
									<div>Hero: <span><?php print $item_detail->HERO_NAME; ?></span></div>
									<div>Rarity: <span style="color: #ac2cd8"><?php print $item_detail->ITEM_RARITY; ?></span></div>
									<div>Release Date: <span><?php print $item_detail->ADD_DATE; ?></span></div>
									<br/>
									<div>Description: </div>
									<div><?php echo $item_detail->DESCRIPTION; ?></div>
									<p class="productinfo"><b><small>Price: <?php if($item_detail->PRICE != '') echo $item_detail->PRICE; else echo $item_detail->PRICEVN; ?> VND</small></b></p>
									<form action="<?php echo base_url(); ?>cart/add_cart" method="POST">
										<?php if($this->session->userdata('username') != ''): ?>
								        	<button type='submit' name='btnAction' value='addcart' class="btn btn-success" >Add to Cart</button>
								    	<?php else: ?>
								    		<button type='submit' name='btnAction' value='addcart' class="btn btn-success" disabled >Add to Cart</button>
								    	<?php endif; ?>
										<input type='hidden' name='productid' value='<?php print $item_detail->ITEM_ID; ?>' />
									</form>
								</div>
								<br/>

								<div class="previewimage">
									<?php
										if(is_array($item_previews))
										{
											echo "<h4>IMAGE PREVIEW</h4>";
										}
										else
										{
											echo "<h4>NO IMAGE PREVIEW</h4>";
										}
									?>
									<?php if(is_array($item_previews)): ?>
									<div class="row Contains1">
										<?php foreach($item_previews as $item_preview): ?>
										<!-- Image Modal -->
										<div class="modal fade" id="<?php print $item_previews->ITEM_PREVIEW_ID; ?>" tabindex="-1" role="dialog" aria-labelledby="ImageModalLabel" aria-hidden="true">
										    <div class="modal-dialog">
										        <div class="modal-content" style="background-color: transparent; box-shadow: none; border: none;">
										            <div class="modal-body text-center">
										                <img src="<?php print $item_previews->IMAGE_URL; ?>" class="productimage" >
										            </div>
										        </div>
										    </div>
										</div>
										<div class="col-md-4">
											<div class="ImageItem">
												<a href='#' data-toggle='modal' data-target='#<?php print $item_previews->ITEM_PREVIEW_ID; ?>' id='<?php print $item_previews->ITEM_PREVIEW_ID; ?>' >
										        	<img src="<?php print $item_previews->IMAGE_URL; ?>" class="productimageContains" >
										        </a>
											</div>
										</div>
										<?php endforeach; ?>
									</div>
									<?php endif; ?>
								</div>
							</div>
						</div>
					</div>
				</div>

				<?php if(is_array($related_items)): ?>
				<div class="ItemSetContains">
					<div class="row Header">
						<div class="col-md-12">
							<br/>
							<h4>SET CONTAINS <?php echo count($related_items);?> ITEMS</h4>
						</div>
					</div>

					<div class="ImageContains">
						<div class="row">
							<div class="col-md-7">
								<div class="row Contains">
									<?php foreach($related_items as $related_item): ?>
										<div class="col-md-3">
											<div class="ImageItem">
												<a href="<?php echo base_url(); ?>item/get_info_item_by_id/<?php print $related_item->ITEM_ID ?>">
													<img class="productimageContains" src="<?php print $related_item->ITEM_IMAGE; ?>">
												</a>
											</div>
										</div>
									<?php endforeach; ?>
								</div>
							</div>
						</div>
					</div>
				</div>
				<?php endif; ?>

				<div class="PreviewVideo">
					<div class="row Header">
						<div class="col-md-12">
							<br/>
							<?php if(!is_null($item_detail->ITEM_VIDEO)): ?>
								<h4>PREVIEW VIDEO</h4>
							<?php else: ?>
								<h4>NO PREVIEW VIDEO</h4>
							<?php endif; ?>
						</div>
					</div>

					<div class="Video">
						<div class="row">
							<div class="col-md-7">
								<?php if(!is_null($item_detail->ITEM_VIDEO)): ?>
									<div class="embed-responsive embed-responsive-16by9">
										<iframe class="embed-responsive-item" src="<?php print $item_detail->ITEM_VIDEO; ?>" allowfullscreen></iframe>
									</div>
								<?php endif; ?>
							</div>
						</div>
					</div>
				</div>
			<?php endforeach; ?>
			</div>
		</div>


		<!-- Footer -->
		<?php $this->load->view('layout/Footer'); ?>

	</body>
</html>